package DataStructureAndAlgorithm.AcWing_每日一题.数学.分解质因数;

//链接：https://www.acwing.com/problem/content/3818/

import java.util.Scanner;

class AcWing_3815{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int z = 0; z < t; z++){
            long n = in.nextLong();
            long res = 1;
            for (int i = 2; i <= n / i; i++){
                if (n % i == 0){
                    res *= i;
                    while (n % i == 0)n /= i;
                }
            }
            res *= n;
            System.out.println(res);
        }
        in.close();
    }
}
